import { Component, OnInit } from '@angular/core';
import {AlertController, NavController} from "@ionic/angular";

@Component({
  selector: 'app-d07',
  templateUrl: './d07.page.html',
  styleUrls: ['./d07.page.scss'],
})
export class D07Page implements OnInit {

  constructor(public navCtrl:NavController,public alertCtrl:AlertController) { }

  ngOnInit() {
  }
  click1() {
    let map = new BMap.Map("bdmap");
    map.centerAndZoom(new BMap.Point(116.404, 39.915), 14);
    let transit = new BMap.TransitRoute(map, {
      renderOptions: {
        map: map,
        autoViewport: true
      },
      intercityPolicy: BMAP_INTERCITY_POLICY_EARLY_START,
      transitTypePolicy:BMAP_TRANSIT_TYPE_POLICY_AIRPLANE
    });
    let start = new BMap.Point(116.310791,40.003419);
    let end = new BMap.Point(121.490546,31.233585);
    transit.search(start,end);
  }

  click2(){
    let map = new BMap.Map("bdmap");
    map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);
    let local = new BMap.LocalSearch(map,{
      renderOptions:{map:map}
    });
    local.search("景点");
  }

  click3(){
    let map = new BMap.Map("bdmap");
    let mPoint = new BMap.Point(116.404,39.915);
    map.enableScrollWheelZoom();
    map.centerAndZoom(mPoint,15);
    let circle = new BMap.Circle(mPoint,1000,{fillColor:"blue",strokeWeight:1,fillOpacity:0.3,strokeOpacity:0.3});
    map.addOverlay(circle);
    let local = new BMap.LocalSearch(map,{
      renderOptions:{
        map:map,
        panel:"r-result",
        autoViewport:false
      }
    });
    local.searchNearby('餐馆',mPoint,1000);
  }
  click4(){
    let map = new BMap.Map("bdmap");
    map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);
    let local = new BMap.LocalSearch(map,{
      renderOptions:{
        map:map,
        panel:"r-result"
      }
    });
    local.search("餐饮");
  }
}
